/*
 * scurand.c, random numbers for SmartCam skeleton system
 */
 
#define _XOPEN_SOURCE 500

#include "scurand.h"
#include <sys/time.h>
#include <time.h>

void init_genrand(unsigned long s);
unsigned long genrand_int32(void);
long genrand_int31(void);
double genrand_real1(void);
double genrand_real2(void);
double genrand_real3(void);
double genrand_res53(void);

double scuRnd(void)
{
  static int initialized = 0;
  
  if (!initialized)
  {
    struct timeval tv;
    
    gettimeofday(&tv, NULL);
    
    init_genrand(tv.tv_usec);
    
    initialized = 1;
  }
  
  return genrand_real1();
} 
